﻿using System;
using System.Collections.Generic;
using Abp.Runtime.Validation;
using NPOI.OpenXmlFormats.Spreadsheet;
using pandx.Mulan.Authorization.Users;
using pandx.Mulan.Dto;

namespace pandx.Mulan.OrganizationUnits.Dto
{
    public class FindOrganizationUnitUsersInput:PagedSortedAndFilteredInput,IShouldNormalize
    {
        public long OrganizationUnitId { get; set; }
        public List<Gender> Gender { get; set; }
        public List<bool> IsActive { get; set; }

        public void Normalize()
        {
            if (string.IsNullOrEmpty(Sorting))
            {
                Sorting = "User.Name ASC";
            }else if (Sorting.Contains("UserName", StringComparison.OrdinalIgnoreCase))
            {
                Sorting = Sorting.Replace("UserName", "User.UserName", StringComparison.OrdinalIgnoreCase);
            }else if (Sorting.Contains("Name", StringComparison.OrdinalIgnoreCase))
            {
                Sorting=Sorting.Replace("Name", "User.Name", StringComparison.OrdinalIgnoreCase);
            }

            Filter = Filter?.Trim();

        }
    }
}
